<template>
	<view class="g-h5 body-content">
		<u-navbar back-text="返回" title="今天"></u-navbar>
		<view class="collect-content">
			<u-sticky>
				<view class="collect-title-view">
					<view :class="menuCurrent === 0 ? 'bank-view-sel' : 'bank-view'" @tap.stop="menuCurrent = 0">
						<view><u-icon name="clock"></u-icon></view>
						<view>从新到旧</view>
					</view>
					<view :class="menuCurrent === 1 ? 'bank-view-sel' : 'bank-view'" @tap.stop="menuCurrent = 1">
						<view><u-icon name="clock"></u-icon></view>
						<view>不限类别</view>
					</view>
					<view :class="menuCurrent === 2 ? 'bank-view-sel' : 'bank-view'" @tap.stop="menuCurrent = 2">
						<view><u-icon name="clock"></u-icon></view>
						<view>标题列表</view>
					</view>
				</view>
			</u-sticky>
			<view class="collect-content-view">
				<view class="remark-content-view" v-for="(item,index) in collectList" :key="index"
					@tap.stop="goNote(item)">
					<view class="remark-list-top">
						<view class="remark-text-view">
							<view class="remark-title">{{item.content}}</view>
							<view class="remark-text">{{item.tips ? item.tips : '暂无标注'}}</view>
						</view>
						<image class="remark-image" :src="item.image" mode=""></image>
					</view>
					<view class="remark-book-bottom">
						<view class="remark-import-text">
							{{item.time ? item.time : '1585926095536' | timeFrom('yyyy-mm-dd hh:MM:ss')}}</view>
						<view><u-icon name="coupon-fill" size="38"></u-icon></view>
					</view>
				</view>
			</view>
		</view>
		<u-tabbar v-model="tabCurrent" :list="tabList"></u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuCurrent: 0,
				collectList: [],
				tabList: [{
						iconPath: 'home',
						selectedIconPath: 'home-fill',
						text: '在读',
						customIcon: false,
						pagePath: '/pages/miniprogram/index'
							 					},
					{
						iconPath: 'photo',
						selectedIconPath: 'photo-fill',
						text: '书架',
						customIcon: false,
						pagePath: '/pages/miniprogram/books'
							 					},
					{
						iconPath: 'https://cdn.uviewui.com/uview/common/min_button.png',
						selectedIconPath: 'https://cdn.uviewui.com/uview/common/min_button_select.png',
						text: '书店',
						customIcon: false,
						pagePath: '/pages/miniprogram/bookshop'
							 					},
					{
						iconPath: 'play-right',
						selectedIconPath: 'play-right-fill',
						text: '我的',
						customIcon: false,
						pagePath: '/pages/miniprogram/user'
							 					},
							 				],
				tabCurrent: 0,
			}
		},
		onLoad() {
			this.collectList = this.$api.note_list()
		},
		methods: {
			goRead() {
				uni.navigateTo({ url: '/pages/miniprogram/reader?isbuy=' + 1 })
			},
			goDetail() {
				uni.navigateTo({ url: '/pages/miniprogram/collect-detail' })
			},
			goNote(item) {
				uni.navigateTo({ url: '/pages/miniprogram/collect-detail?data=' + JSON.stringify(item) })
			}
		}
	}
</script>

<style scoped>
	.collect-content {
		margin: 20rpx;
		border-radius: 10rpx;
	}

	.collect-title-view {
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #E1E2E7;
		padding: 20rpx;
		border-radius: 12rpx;
	}

	.bank-view {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 1;
	}

	.bank-view-sel {
		display: flex;
		align-items: center;
		justify-content: center;
		flex: 1;
		color: #4B5DE7;
	}

	.collect-content-view {
		padding: 20rpx;
		/* background-color: #fff; */
		border-radius: 12rpx;
		margin-top: 20rpx;
	}

	.collect-list-view {
		padding: 20rpx 0;
		border-bottom: 1rpx solid #999;
	}

	.list-title {
		font-size: 30rpx;
	}

	.list-b-view {
		display: flex;
		justify-content: space-between;
		margin-top: 20rpx;
		font-size: 24rpx;
		color: #999;
	}

	.remark-content-view {
		border-radius: 20rpx;
		background-color: #ffffff;
		padding: 20rpx 30rpx;
		margin-bottom: 20rpx;
	}

	.remark-list-top {
		display: flex;
		justify-content: space-between;
	}

	.remark-title {
		font-size: 30rpx;
		width: 480rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.remark-text {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
		width: 480rpx;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.remark-image {
		width: 120rpx;
		height: 120rpx;
	}

	.remark-book-bottom {
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.remark-import-text {
		padding: 4rpx 12rpx;
		background-color: #F7E598;
		font-size: 24rpx;
		border-radius: 6rpx;
	}
</style>